classification
Title: Fractions do not support other Fractions as numerators or denominators
Type: behavior Stage:
Components: Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: amyodov, mark.dickinson
Priority: normal Keywords:

Created on 2009-07-30 09:33 by amyodov, last changed 2009-07-30 10:05 by mark.dickinson. This issue is now closed.

Messages (3)
msg91088 - (view) Author: Alexander Myodov (amyodov) Date: 2009-07-30 09:33
Occurs in 2.6, doesn't occur in 3.1.
Example:

Python 2.6.2+ (release26-maint, Jun 23 2009, 07:08:39)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fractions import Fraction
>>> Fraction(Fraction(3,5), Fraction(1,2))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/fractions.py", line 99, in __new__
    numerator = operator.index(numerator)
TypeError: 'Fraction' object cannot be interpreted as an index


Compare:

Python 3.1 (r31:73572, Jul 23 2009, 23:41:26)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fractions import Fraction
>>> Fraction(Fraction(3,5), Fraction(1,2))
Fraction(6, 5)
msg91090 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-07-30 09:53
Support for this was already added in 2.7 in r71832 (see issue 5812).  
Since this was a new feature and not a bugfix I don't think it would be 
appropriate to backport this change to 2.6.
msg91091 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-07-30 10:05
Hmm.  I've just noticed that r71832 didn't properly update the docs.  
Fixed in r74265 (trunk), r74267 (py3k) and r74268 (release31-maint).
History
Date User Action Args
2009-07-30 10:05:44mark.dickinsonsetmessages: + msg91091
2009-07-30 09:53:04mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg91090

resolution: out of date
2009-07-30 09:33:14amyodovcreate