[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Alexey Kachayev

Alexey Kachayev added the comment:

Ok, I think that ValueError is more appropriate and I have already attached 
adopted patch for issue 16483.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson

Mark Dickinson added the comment:

See issue #16483 for the ValueError / OverflowError switch.  To be honest, 
while I would have preferred ValueError to OverflowError for int(float('inf')) 
if we were doing this from scratch, I'm not convinced that it's actually worth 
switching.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson

Mark Dickinson added the comment:

Fixed in http://hg.python.org/cpython/rev/a2b54b6d9759.  Thanks for the report 
and patch.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson

Mark Dickinson added the comment:

The first patch looks great (modulo a stray extra line in test_int). Thank you!

Let's just apply that for now; I'll open a new issue for the suggested 
OverflowError / ValueError switch.  (Getting rid of the TypeError seems a clear 
win to me;  switching the OverflowError to ValueError may be more 
controversial.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Alexey Kachayev

Changes by Alexey Kachayev :


Added file: http://bugs.python.org/file27992/full_issues16469_fixed.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Alexey Kachayev

Alexey Kachayev added the comment:

I also attached "full_issue" patch: change OverflowError to ValueError for all 
cases.

--
Added file: http://bugs.python.org/file27991/full_issues16469.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson

Changes by Mark Dickinson :


--
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Alexey Kachayev

Alexey Kachayev added the comment:

Patch is attached for {float, Decimal} -> {int, Fraction} consistency (with 
ValueError and OverflowError). Test cases are changed as well. 

I can also change OverflowError to ValueError for all cases, but I'm not sure 
should I open for this separated issue or continue to work with this one.

--
keywords: +patch
nosy: +kachayev
Added file: http://bugs.python.org/file27990/issue16469.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson

Mark Dickinson added the comment:

> I think consistent behavior between int() and Fraction() is valuable.

Agreed.  If no-one objects I'll fix the Decimal -> Fraction and float -> 
Fraction conversions to match what Decimal -> int and float -> int currently do 
(ValueError and OverflowError).

Then we can open a new issue to discuss having infinities give ValueError 
versus OverflowError for all four cases of {float, Decimal} -> {int, Fraction}.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Case Van Horsen

Case Van Horsen added the comment:

Do we also want to change int(infinity) to return ValueError? I think 
consistent behavior between int() and Fraction() is valuable.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Martin v . Löwis

Martin v. Löwis added the comment:

The description of OverflowError is that is is "raised when the result of an 
arithmetic operation is too large to be represented", so it doesn't actually 
need to overflow. Still, I see that ∞ actually isn't too large to be 
represented (and the documentation points out that integer operations will 
raise MemoryError instead of OverflowError). So yes, ValueError seems more 
appropriate.

+1 for fixing this in 3.4, only.

--
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Mark Dickinson

Mark Dickinson added the comment:

The from_decimal method should be changed as well.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Mark Dickinson

Changes by Mark Dickinson :


--
title: Exceptions raised by Fraction() from those raised by int() -> Exceptions 
raised by Fraction() different from those raised by int()

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com